<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }

        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background: linear-gradient(#141e30, #243b55);
        }

        .login {
            display: flex;
            flex-direction: column;
            align-items: center;
            width: 400px;
            padding: 40px;
            background-color: rgba(0, 0, 0, .2);
            box-shadow: 0 15px 25px rgba(0, 0, 0, .4);
        }

        .login h2 {
            color: #fff;
            margin-bottom: 30px;
        }

        .login .login_box {
            position: relative;
            width: 100%;
        }

        .login .login_box input {
            outline: none;
            border: none;
            width: 100%;
            padding: 10px 0;
            margin-bottom: 30px;
            color: #fff;
            font-size: 16px;
            border-bottom: 1px solid #fff;
            background-color: transparent;
        }

        .login .login_box label {
            position: absolute;
            top: 0;
            left: 0;
            padding: 10px 0;
            color: #ffffff;
            pointer-events: none;
            transition: all 0.5s;
        }

        /* valid检测input输入框内容是否合法，因为之前在input中加入了required所以输入框为空时是不合法的就不会执行下面代码 */
        .login .login_box input:focus+label,
        .login .login_box input:valid+label {
            top: -20px;
            color: #03e9f4;
            font-size: 12px;
        }

        .login a {
            position: relative;
            padding: 10px 20px;
            color: #03e9f4;
            text-decoration: none;
            transition: all 0.5s;
            overflow: hidden;
        }

        .login a:hover {
            color: #ffffff;
            border-radius: 5px;
            background-color: #03e9f4;
            box-shadow: 0 0 5px #03e9f4, 0 0 25px #03e9f4, 0 0 50px #0349f4, 0 0 100px #03e9f4;
        }

        .login a span {
            position: absolute;
        }

        .login a span:first-child {
            top: 0;
            left: -100%;
            width: 100%;
            height: 2px;
            background: linear-gradient(to right, transparent, #03e9f4);
            animation: move1 1s linear infinite;
        }

        .login a span:nth-child(2) {
            right: 0;
            top: -100%;
            width: 2px;
            height: 100%;
            background: linear-gradient(transparent, #03e9f4);
            animation: move2 1s linear 0.25s infinite;
        }

        .login a span:nth-child(3) {
            right: -100%;
            bottom: 0;
            width: 100%;
            height: 2px;
            background: linear-gradient(to left, transparent, #03e9f4);
            animation: move3 1s linear 0.5s infinite;
        }

        .login a span:last-child {
            left: 0;
            bottom: -100%;
            width: 2px;
            height: 100%;
            background: linear-gradient(#03e9f4, transparent);
            animation: move4 1s linear 0.75s infinite;
        }

        @keyframes move1 {
            0% {
                left: -100%;
            }

            50%,
            100% {
                left: 100%;
            }
        }

        @keyframes move2 {
            0% {
                top: -100%;
            }

            50%,
            100% {
                top: 100%;
            }

        }

        @keyframes move3 {
            0% {
                right: -100%;
            }

            50%,
            100% {
                right: 100%;
            }

        }

        @keyframes move4 {
            0% {
                bottom: -100%;
            }

            50%,
            100% {
                bottom: 100%;
            }

        }
    </style>
</head>

<body>
    <div class="login">
        <h2>用户登录</h2>
        <div class="login_box">
            <input type="text" required="required">
            <label>用户名</label>
        </div>
        <div class="login_box">
            <input type="password" required="required">
            <label>密码</label>
        </div>
        <a href="javascript:void(0)">
            登录
            <span></span>
            <span></span>
            <span></span>
            <span></span>
        </a>
    </div>
</body>

</html>